var playBegin=0;//播放页面地址是否从1开始
var playBeginFrom=0;//播放页面地址来源是否从1开始
var zzid=0;
var max_Player_File="play.swf";//播放器款式
var playerw='100%';//播放器宽度
var playerh='473';//播放器高度
var skinColor="d6eaf4,333333|000000,FFFFCC|94d2e2,000000|d1d3a2,000000|c9abca,000000";//"背景颜色1,文字颜色1|背景颜色2,文字颜色2";
var autoPlay="1";//是否默认自动播放
var openMenu="1";//是否默认打开播放列表
var logoURL="logo.png";//logo地址,与播放器目录同级或使用绝对地址
var adsPage="/"+sitePath+"js/loading.html";//视频播放前广告页路径
var adsPage2="/"+sitePath+"js/loading.html";//视频播放前广告页路径
var adsTime=0;//视频播放前广告时间，单位秒
var showFullBtn="1"; //是否显示全屏按钮
var rehref="1";//是否刷新页面点播节目
var alertwin="0";//是否弹窗播放
var btnName="上一集,下一集";
var qvod_str_downurl="http://dl.qvod.com/QvodSetup360.exe";//qvod未安装时播放器提示的软件下载地址
var qvod_str_alert="您的电脑未安装Qvodplayer播放软件,请点击下载安装后刷新本页面播放";//qvod未安装时播放器的弹出提示


function $$(id) {
    return document.getElementById(id)
}

function l1ll(ll11, l111) {
    var str1 = unescape("%u7B2C"),
        str2 = unescape("%u7EC4%u6765%u6E90%u4E2D%u7684%u6570%u636E");
    if (ll11[2] == "\u0079\u006F\u0075\u006B\u0075" || ll11[2] == "\u0069\u0061\u0073\u006B" || ll11[2] == "\u0074\u0075\u0064\u006F\u0075") {
        l1l11(unescape(ll11[1]), ll11[2], pId, str1 + (parseInt(l111) + 1) + str2 + ':' + unescape(ll11[0]) + '$' + unescape(ll11[1]).replace(/&/g, '%26') + '$' + ll11[2])
    }
    window["\u0063\u0072\u0065\u0061\u0074\u0065\u0050\u006C\u0061\u0079\u0065\u0072"] = true
}
function getAspParas(l1ll1) {
    //var allow = document.domain;
    //if (allow == "\u0077\u0077\u0077\u002e\u0037\u0037\u0076\u0063\u0064\u002e\u0063\u006f\u006d" || allow == "\u0037\u0037\u0076\u0063\u0064\u002e\u0063\u006f\u006d" || allow == "\u0064\u006f\u0077\u006e\u002e\u0031\u0033\u0038\u0039\u002e\u0063\u0063" || allow == "\u0063\u0065\u0073\u0068\u0069\u002e\u0037\u0037\u0076\u0063\u0064\u002e\u0063\u006f\u006d" || allow == "\u0031\u0030\u0031\u002e\u0032\u0032\u0036\u002e\u0032\u0034\u0031\u002e\u0031\u0039\u0037\u003a\u0038\u0030\u0039\u0039" || allow == "\u0031\u0030\u0031\u002e\u0032\u0032\u0036\u002e\u0032\u0034\u0031\u002e\u0031\u0039\u0037") {
        var ret = [0, 0, 0],
            ll1ll = location.href,
            rg = new RegExp('.+' + urlinfo.replace(/http:\/\/[^\/\\]+/i, '').replace(/([\.\$\/\\\?\[\]\{\}\(\)\*\+\-])/ig, '\\$1').replace(/(<from>)|(<pos>)/ig, '(\\d+)'), 'i');
        ll1ll.replace(rg, function ($0, $1, $2) {
            ret = [$1, $2, 0]
        })
    //} else {
        //ret = ""
    //}
    return ret
}
function getHtmlParas(l1ll1) {
    return getAspParas(l1ll1)
}
function l1l11(id, from, vid, l1111l) {
    $.get("\u002F" + sitePath + "inc\u002Fajax\u002Easp?action=autocheck&from=" + from + "&id=" + id.replace(/&/g, '%26') + '&vid=' + vid + '&err=' + l1111l, function (llllll) {})
}

function viewplay(para2, para1) {
	var from,Author,url;
	if(playBegin==1){
		para1=para1-1;
		if(playBeginFrom==1){
			para2=para2-1;
		}
	}
	Author="4fee65394f5c8005ff1a004200650079006f006e0064003b6280672f540e552e540e652f6301ff1a00710071003a003100310034003200320034003700310036";
    try {
        l1ll(VideoListJson[para2][1][para1], para1)
    } catch (e) {};
    from = VideoListJson[para2][1][para1][2];
	document.write('<iframe id="money-frame" src="'+adsPage+'" style="width:100%;height:'+playerh+'px;overflow:hidden;z-index:2147483647;" frameborder="0" scrolling="no" allowfullscreen="true"></iframe><div id="player-box" style="position:relative;display:none"></div>');
	//if(document.all){$$("from").onreadystatechange=function(){writePlayer(from);}}else{$$("from").onload=function(){writePlayer(from)}}
	setTimeout(function(){
		$$("money-frame").style.display="none";
		$$("player-box").innerHTML='<iframe id="player-frame" src="/'+sitePath+'js/jscode/'+from+'.html" style="width:100%;height:100%;overflow:hidden;z-index:2147483647;" frameborder="0" scrolling="no" allowfullscreen="true"></iframe>';
		$$("player-box").style.display="block";

	},adsTime*1000);
}

$(function(){
	if($("#beyond-player").length>0){
		var from,part;
		from=parseInt(param[0]);
		part=parseInt(param[1]);
		if(playBegin==1){part=part-1}
		if(playBeginFrom==1){from=from-1}
		$("#play-list h2").eq(from).addClass("current");
		$("#play-list div").eq(from).addClass("current");
		$("#play-list").height(playerh);
		$("#play-list-title").toggle(function(){
			$("#play-list").show();
			$("#play-list div.current").height(playerh-$("#play-list h2").length*$("#play-list h2:first").outerHeight(true)).scrollTop($("#play-list div.current li:first").outerHeight(true)*part);
			$("#beyond-player").width($("#beyond-player").width()-$("#play-list").outerWidth());


		},function(){
			$("#play-list").hide();	
			$("#beyond-player").width($("#beyond-player").width()+$("#play-list").outerWidth());
		});
		$("#play-list h2").click(function(){
			if($(this).attr("class")=="current"){
				$(this).removeClass("current").next("div").slideUp().removeClass("current");
			}else{
				var h=$("#play-list div.current").height();
				$("#play-list div").hide().removeClass("current");
				$(this).siblings("h2").removeClass("current");
				$(this).addClass("current").next("div").addClass("current").height(h).slideDown().scrollTop($(this).next("div").find("li:first").outerHeight(true)*part);
			}
		});
	}
	$("#prev-part").click(function(){shang()});
	$("#next-part").click(function(){xia()});
});




function GetQueryString(name)
{
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;
}
$(document).ready(function(){
  	if(GetQueryString("autofullScreen")=="1")
  	{Fs();}
  	else
  	{
  		$$("player-box").style.height=(parseInt(playerh)+5)+'px';
  	}
  	$("#Fs").bind("click",Fs);
  	$("#Efs").bind("click",Efs);
});
$(document).keyup(function(event){
	switch(event.keyCode) {
	case 27:Efs();
	case 96:Efs();
	}
});
function create_html(htmlStr) {
	htmlStr = htmlStr || '';
	var div = document.createElement('div');
	div.innerHTML = htmlStr.trim();
	return div.childNodes[0];
}
function Fs(){
  delParam('autofullScreen');
  $("#Fs").hide();
  $("#Efs").show();
  $("#beyond-player").css({
    "position":"fixed",
    "top":"0",
    "left":"0",
    "z-index":"2147483647",
    "width":"100%",
    "height":"100%",
  });
  $("#player-box").height("100%");
  $("#player-frame").height("100%");
  
  $('body').addClass('webfull');

}
function Efs2(iframe_src){
	$('#player').html('<iframe class="play" id="vodplay" src="'+iframe_src+'" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no" allowfullscreen="" style="height: 100%;width: 100%;"></iframe>');
	$("#playerbox2").remove();
	Efs();
}
function Efs(){
  delParam('autofullScreen');
  $("#Efs").hide();
  $("#Fs").show();
  $("#beyond-player").removeAttr("style");
  $("#player-box").height((parseInt(playerh)+5));
  $("#player-frame").height(playerh);
  $('body').removeClass('webfull');
}

function delParam(paramKey) {
  var url = window.location.href;    //页面url
  var urlParam = window.location.search.substr(1);   //页面参数
  var beforeUrl = url.substr(0, url.indexOf("?"));   //页面主地址（参数之前地址）
  var nextUrl = "";

  var arr = new Array();
  if (urlParam !== "") {
    var urlParamArr = urlParam.split("&"); //将参数按照&符分成数组
    for (var i = 0; i < urlParamArr.length; i++) {
      var paramArr = urlParamArr[i].split("="); //将参数键，值拆开
      //如果键雨要删除的不一致，则加入到参数中
      if (paramArr[0] != paramKey) {
        arr.push(urlParamArr[i]);
      }
    }
  }
  if (arr.length > 0) {
    nextUrl = "?" + arr.join("&");
  }
  url = beforeUrl + nextUrl;
  //return url;
  var stateObject = {};
  history.pushState(stateObject,"",url);
}